using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.RepositoryFactory.SchemaDiscovery.ObjectModel.Base;

namespace Microsoft.Practices.RepositoryFactory.CustomPages.Validators
{
    internal class TableValidator : IValidator
    {
        #region Properties
        private Table table;

        public Table Table
        {
            get { return table; }
            set { table = value; }
        }

        #endregion
        #region Constructors
        public TableValidator(Table table)
        {
            this.table = table;
        }
        #endregion

        #region IValidator Members

        public bool IsValid()
        {
            bool response = true;

            foreach(Column column in table.Columns)
            {
                if(!new ColumnValidator(column).IsValid())
                {
                    response = false;
                    break;
                }
            }

            return response;
        }

        #endregion
    }
}
